package com.daokin.util;

import com.fasterxml.jackson.databind.JsonMappingException;
import java.io.IOException;
import java.util.Map;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.ObjectMapper;

/**
 *
 * @author Dell
 */
public class JSONPUtil {
    
    public static String getJsonP(Map map,String callback)  
    {  
        ObjectMapper mapper = new ObjectMapper();  
        String content = null;  
        try {  
            content = mapper.writeValueAsString(map);  
            System.out.println(content);  
        } catch (JsonGenerationException e) {  
            e.printStackTrace();  
        } catch (JsonMappingException e) {  
            e.printStackTrace();  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
        return callback+"("+content+")";  
    }  
}
